﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;

public partial class ybqy_print_1_3 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection sqlcon = new SqlConnection();
        sqlcon.ConnectionString = ConfigurationManager.ConnectionStrings["SqlConnectionString"].ConnectionString;
        sqlcon.Open();

        SqlCommand sqlcmd1 = new SqlCommand("select * from a01103 where  ShenBaoNianDu='" + Session["ShenBaoNianDu"] + "' and qiyeid=" + Session["qiyeid"], sqlcon);


        SqlDataReader reader1 = sqlcmd1.ExecuteReader(CommandBehavior.CloseConnection);

        if (!reader1.Read())
        {
      }
        else
        {
            if (reader1["PRODUCT_NAME"].ToString() == "" || reader1["PRODUCT_NAME"].ToString() == null)
            {
                HiddenField_id.Value = reader1["id"].ToString();
                HiddenField_xiugai.Value = "edit";

            }

        }

    }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (((GridView)e.Row.FindControl("GridView3")) != null)
        {
            // 无论什么乱七八糟的代码，主要是在这里绑定GridView里的那个GridView
            string tProjectID = (e.Row.FindControl("lbhidden") as Label).Text;
            SqlConnection sqlcon = new SqlConnection();
            sqlcon.ConnectionString = ConfigurationManager.ConnectionStrings["SqlConnectionString"].ConnectionString;
            sqlcon.Open();

            SqlCommand sqlcmd = new SqlCommand("select * from a01103_f where zhubiaoid=" + tProjectID + " and ShenBaoNianDu='" + Session["ShenBaoNianDu"] + "' and qiyeid=" + Session["qiyeid"], sqlcon);


            GridView tempGV = (e.Row.FindControl("GridView3") as GridView);
            tempGV.DataSource = sqlcmd.ExecuteReader(CommandBehavior.CloseConnection);
            tempGV.DataBind();
        }


    }
}